<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <title>登录</title>
    <link rel="stylesheet" href="../frame/layui/css/layui.css">
    <link rel="stylesheet" href="../frame/static/css/style.css">
    <link rel="icon" href="../frame/static/image/code.png">
    <style>
        .body {
            width: 100%;
            height: 100%;
            position: absolute;
            top:0;
            left:0;
            background-color: #16a085;
            overflow: hidden;
        }
        .login {
            height: 260px;
            width: 260px;
            padding: 20px;
            background-color: rgba(0, 0, 0, 0.5);
            border-radius: 4px;
            position: absolute;
            left: 50%;
            top: 50%;
            margin: -150px 0 0 -150px;
            z-index: 99;
        }

        .login h1 {
            text-align: center;
            color: #fff;
            font-size: 24px;
            margin-bottom: 20px;
        }

        .form_code {
            position: relative;
        }

        .form_code .code {
            position: absolute;
            right: 0;
            top: 1px;
            cursor: pointer;
        }

        .login_btn {
            width: 100%;
        }
    </style>
</head>
<body>
<div class="body">
    <div class="login">
        <h1>管理员登录</h1>
        <form class="layui-form">
            <div class="layui-form-item">
                <input class="layui-input" name="username" placeholder="用户名" value="" lay-verify="required"
                       lay-verType="tips" type="text" autocomplete="off">
            </div>
            <div class="layui-form-item">
                <input class="layui-input" name="password" placeholder="密码" value="" lay-verify="required"
                       lay-verType="tips" type="password" autocomplete="off">
            </div>
            <div class="layui-form-item form_code">
                <input class="layui-input" style="width: 140px;" name="captcha" placeholder="验证码" lay-verify="required"
                       lay-verType="tips" type="text" autocomplete="off">
                <div class="code"><img id="captcha" src="../frame/static/image/v.png" width="116" height="36"
                                       onclick="this.src='../frame/static/image/v.png&'+Math.random()"></div>
            </div>
            <button class="layui-btn login_btn" lay-submit="" lay-filter="login">登录</button>
        </form>
    </div>
</div>
<script src="https://cdn.bootcss.com/jquery/3.3.1/jquery.min.js"></script>
<script type="text/javascript" src="../frame/layui/layui.js"></script>
<script type="text/javascript" src="../frame/static/js/jquery.particleground.min.js"></script>
<script type="text/javascript">
    layui.use(['form', 'layer'], function () {
        //$("#captcha").attr("src", '/captcha/default?' + Math.random());//刷新验证码 的
        // 操作对象
        var form = layui.form
            , layer = layui.layer
            , $ = layui.jquery;

        // 验证
        form.verify({
            account: function (value) {
                if (value == "") {
                    return "请输入用户名";
                }
            },
            password: function (value) {
                if (value == "") {
                    return "请输入密码";
                }
            },
            code: function (value) {
                if (value == "") {
                    return "请输入验证码";
                }
            }
        });

        // 提交监听
        form.on('submit(sub)', function (data) {
            layer.alert(JSON.stringify(data.field), {
                title: '最终的提交信息'
            });
            return false;
        });

        // you code ...
        //粒子
        $('.body').particleground({
            dotColor: '#5cbdaa',
            lineColor: '#5cbdaa'
        });
    })

</script>
</body>
</html>